<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	  xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">
<h:head>
    <title>Instituto Missionário de Ensino El Shaday</title>
    <link rel="stylesheet" href="css/gemepde.css"  />
</h:head>
<h:body style="font-size: 14px;">
	<div id="geral">
		<h:form id="formCadastro">
			<p:growl id="messages" showDetail="false" />
			<p:panel header="Cadastro de Aluno" style="margin:5px; width: auto;">
				<p:panelGrid>
					<p:row>
						<p:column>
							<div align="center" id="foto">
								<p:graphicImage id="photo" value="#{alunoBean.streamContentAvatar}" width="180" height="188" rendered="#{not empty alunoBean.nomeArquivoAvatar}">
									<f:param name="photoParam" value="#{alunoBean.nomeArquivoAvatar}" />
								</p:graphicImage>
								<p:graphicImage value="/images/avatar_padrao.jpg" width="180" height="188" rendered="#{empty alunoBean.nomeArquivoAvatar}"/>
							</div>
						</p:column>
					</p:row>
					<p:row>
						<p:column>
							<div align="center">
								<p:commandButton value="Upload Foto" icon="ui-icon-circle-arrow-n" onclick="dialogUploadFoto.show();" />
							</div>
						</p:column>
					</p:row>

				</p:panelGrid>
			   	
				<f:facet name="footer">  
					<h:outputLabel style="padding-left: 600px;"/>
					<p:commandButton id="btn-cancelar" action="#{alunoBean.cancelarCadastro}" value="Cancelar" icon="ui-icon-closethick" style="margin:0"/>
					<h:outputLabel style="padding-left: 100px;"/>
					<p:commandButton id="btn-reset" type="reset" value="Limpar" icon="ui-icon-minusthick" style="margin:0"/>
					<h:outputLabel style="padding-left: 100px;"/>
			        <p:commandButton id="btn-salvar" action="#{alunoBean.salvarAluno()}" value="#{alunoBean.tipoBotaoCadastro}" icon="ui-icon-disk" style="margin:0" />
			    </f:facet>
			   	
			</p:panel>
		</h:form>
	</div>	

<!-- ADICIONAR FOTO PRINCIPAL -->
<p:dialog widgetVar="dialogUploadFoto" modal="true" header="Upload Foto"
		width="auto" showEffect="fade" hideEffect="fade" resizable="false" id="uploadFotoDialog">
	
	<h:form id="formUploadAvatar" enctype="multipart/form-data">
	
		<p:fileUpload value="#{alunoBean.uploadFileAvatar}" mode="simple" />
		<div align="right" style="float: right; display: block;">
			<p:commandButton value="Anexar" ajax="false" actionListener="#{alunoBean.handleFileUploadAvatar}" oncomplete="dialogUploadFoto.hide()"/>
		</div>
	</h:form>
	
</p:dialog>
	
</h:body>
</html>